<jsp:include page="../../header.jsp">
			<jsp:param value="item5" name="item"/>
</jsp:include> 
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="java.io.File"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<section class="content">
	<section class="widget">
		<header>
			<span class="icon">&#128196;</span>
			<hgroup>
				<h1>个人出差记录</h1>
				<h2>详情列表，<label><a href="javascript:void(0);" id="msg"><font color="#5daced">差旅标准详情</font></a></label>
						<input type="hidden" name="travelstandrad" id="travelstandrad" value='<s:property value="travelstandrad"/>'>
				</h2>
			</hgroup>
		</header>
		<div class="content">

   <div class="tabs" id="tabs">
   <s:if test='!businessTravelList.verifierStatus.equals("待审核")
   &&!businessTravelList.verifierStatus.equals("审核通过")
   &&!businessTravelList.verifierStatus.equals("审核不通过")'>
	<ul>
    	<li>出差详情</li>
    	<li class="on">报销详情</li>
    </ul>
  <div class="hide">
	<p id="purtitle" align="center">
		<label for="purCode">出差单号:</label>
		<label for="purCode"><s:property value="businessTravelList.travelOrder"/></label>
		<label for="purCode">&nbsp;&nbsp;开始时间:</label>
		<label for="purCode"><s:date name="businessTravelList.startTime" format="yyyy-MM-dd" /></label>
			
		<label for="purCode">&nbsp;&nbsp;结束时间:</label>
		<label for="purCode"><s:date name="businessTravelList.endTime" format="yyyy-MM-dd" /></label>
		
		<br/>
		
		
		<label for="purCode">&nbsp;&nbsp;职工号:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userid"/></label>  
		
		<label for="purCode">&nbsp;&nbsp;职工姓名:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userName"/></label>
		
		<label for="purCode">&nbsp;&nbsp;总&nbsp;预&nbsp;算:</label> 
		<label for="purCode"><s:property value="businessTravelList.amount"/></label>
	
		<label for="purCode">&nbsp;&nbsp;状&nbsp;&nbsp;&nbsp;态:</label> 
		<label for="purCode"><s:property value="businessTravelList.verifierStatus"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;审&nbsp;批&nbsp;人:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByVerifierId.userName"/></label>
		
	</p>
	<s:if test="businessTravels!=null&&businessTravels.size()!=0">
	<table  id="myTable">
		<tr>
			<th>开始地点</th>
			<th>目的地</th>
			<th>距离/公里</th>
			<th>交通方式</th>
			<th>住宿</th>
			<th>餐饮费/天</th>
			<th>其他费用/天</th>
			<th>天数</th>
			<th>本次费用/元</th>
		</tr>
		<s:iterator value="businessTravels" id="row" status="state">
			<tr>
				 <td align="center">
					<s:property value="#row.startPlace"/>
				</td>
				 <td align="center">
				 	<s:property value="#row.endPlace"/>
				</td>
				<td align="center">
					<s:property value="#row.distance"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.traffic.traffic"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.hotel.hotel"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.mealsCost"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.elseCost"/>
				</td>
				<td align="center">
					<s:property value="#row.time"/>
				</td>
				<td align="center">
					<s:property value="#row.sum"/>
				</td>
			</tr>
		</s:iterator>
	</table>
	</s:if>
	<s:else>
	<h2>没有具体的出差信息</h2>
	</s:else>
 </div>
   <div class="show">
   <form action="applayReimAction!getTravelInfoList.action" name="getTravelInfoList" method="post">
	<p id="purtitle" align="center">
	
	
		<label for="purCode">报销时间:</label>
		<label for="purCode"><s:date name="applayReim.applayTime" format="yyyy-MM-dd" /></label>
	
			<label for="purCode">&nbsp;&nbsp;出差单号:</label>
			<label for="purCode"><s:property value="businessTravelList.travelOrder"/></label> 
			<input type="hidden"  name="travelorder"
			value="<s:property value="businessTravelList.travelOrder"/>">
		<label for="purCode">&nbsp;&nbsp;职工号:</label> 
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userid"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;职工姓名:</label> 
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userName"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;状态:</label>
		<label for="purCode"><s:property value="businessTravelList.verifierStatus"/></label>
	
			<br/>
		<label for="purCode">申请报销/元:</label>
		<label for="purCode"><s:property value="applayReim.appAmount"/></label>
		<label for="purCode">&nbsp;&nbsp;实际报销/元:</label>
		<label for="purCode"><s:property value="applayReim.realAppAmount"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;节省/元:</label>
		<label for="purCode"><s:property value="applayReim.saveCost"/></label>  
		<label for="purCode">&nbsp;&nbsp;预算/元:</label>
		<label for="purCode"><s:property value="businessTravelList.amount"/></label>
		
	</p>
	<s:if test="applayReim.applayTime!=null">
	<%
		int receiptssize = 0;
		if(request.getAttribute("receiptssize")!=null)
		{
			receiptssize = Integer.valueOf(request.getAttribute("receiptssize").toString());
			if(receiptssize>0){
	%>
		<table id="myTable">
		
			<tr>
				<th colspan="2">收据类型
				</th>
				<th>文件名</th>
				<th>备注</th>
				<th>操作</th>
			</tr>
			
			<s:iterator value="#request.traficeFileMap" status="stuts">
					<tr>
						<td><input name="url" type="checkbox" id="url"
							value="<s:property value="key" />,<s:property value="key" />">
						</td>
						<td>
							交通
						</td>
						<td>
						  <s:property value="key" /> 
						<%-- <img src="<%=rRootPath%><s:property value="key" />" width="400xp;" height="400xp;"> --%>
						</td>
						<td>
							<s:property value="value" />
						</td>
						<td><input type ="button" class="button white" value="下载" 
							onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
						</td>
					</tr>
					
			</s:iterator>
			
			<s:iterator value="#request.mealFileMap" status="stuts">
			
					<tr>
						<td><input name="url" type="checkbox" id="url"
							value="<s:property value="key" />,<s:property value="key" />">
						</td>
						<td>
							餐饮
						</td>
						<td>
						  <s:property value="key" /> 
						</td>
						<td>
							<s:property value="value" />
						</td>
						<td><input type ="button" value="下载" class="button white"
							onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
						</td>
					</tr>
					
			</s:iterator>
			
			<s:iterator value="#request.hotelFileMap" status="stuts">
			
					<tr>
						<td><input name="url" type="checkbox" id="url"
							value="<s:property value="key" />,<s:property value="key" />">
						</td>
						<td>
							住宿
						</td>
						<td>
						  <s:property value="key" /> 
						</td>
						<td>
							<s:property value="value" />
						</td>
						<td><input type ="button" value="下载" class="button white"
							onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
						</td>
					</tr>
					
			</s:iterator>
			
			<s:iterator value="#request.elseFileMap" status="stuts">
					<tr>
						<td><input name="url" type="checkbox" id="url"
							value="<s:property value="key" />,<s:property value="key" />">
						</td>
						<td>
							其他
						</td>
						<td>
						  <s:property value="key" /> 
						</td>
						<td>
							<s:property value="value" />
						</td>
						<td><input type ="button" value="下载" class="button white"
							onclick="downloadFile1('<s:property value="key" />','<s:property value="key" />')" />
						</td>
					</tr>
					
			</s:iterator>
		
		</table>
		<div align="center">	
			<a href="personTravelInfoAction!getPersonTravelList.action">返回个人出差记录管理</a>
			<s:if test='businessTravelList.verifierStatus.equals("报销不通过")
			||businessTravelList.verifierStatus.equals("待报销")'>
				<input type="submit" value="修改报销申请" class="button white">
			</s:if>
			<input class="button white" title="选择下载的文件"
				onClick="SelectAll(this.form)" type="button" value="全选"> <input
				class="button white" title="反向选择下载文件" onClick="TurnOver(this.form)"
				type="button" value="反选"> <input class="button white"
				title="下载选中文件" onClick="DownlodSelected(this.form)" type="button"
				value="批量下载文件">
		</div>
			<%} }
			if(receiptssize==0){
			%>
			<h2>没有上传收据</h2>
			<a href="personTravelInfoAction!getPersonTravelList.action">返回个人出差记录管理</a>
				<s:if test='businessTravelList.verifierStatus.equals("报销不通过")
			||businessTravelList.verifierStatus.equals("待报销")'>
				<input type="submit" value="修改报销申请" class="button white">
			</s:if>
			<%} %>
		
	</s:if>
	<s:else>
		<p align="center">没有上传收据</p><br/>
		<a href="personTravelInfoAction!getPersonTravelList.action">返回个人出差记录管理</a>
		<input type="submit" value="填写报销申请" class="button white">
	</s:else>
	
	</form>
	</div>
    </s:if>
    <s:elseif test="businessTravelList!=null">
    <div>
	<p id="purtitle" align="center">
		<label for="purCode">出差单号:</label>
		<label for="purCode"><s:property value="businessTravelList.travelOrder"/></label>
		
		<label for="purCode">&nbsp;&nbsp;开始时间:</label>
		<label for="purCode"><s:date name="businessTravelList.startTime" format="yyyy-MM-dd" /></label>
		<label for="purCode">&nbsp;&nbsp;结束时间:</label>
		<label for="purCode"><s:date name="businessTravelList.endTime" format="yyyy-MM-dd" /></label>
		
		<br/>
		<label for="purCode">&nbsp;&nbsp;职工号:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userid"/></label>  
		
		<label for="purCode">&nbsp;&nbsp;职工姓名:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByUserid.userName"/></label>
		<label for="purCode">&nbsp;&nbsp;总&nbsp;预&nbsp;算:</label> 
		<label for="purCode"><s:property value="businessTravelList.amount"/></label>
	
		<label for="purCode">&nbsp;&nbsp;状&nbsp;&nbsp;&nbsp;态:</label> 
		<label for="purCode"><s:property value="businessTravelList.verifierStatus"/></label> 
		
		<label for="purCode">&nbsp;&nbsp;审&nbsp;批&nbsp;人:</label>
		<label for="purCode"><s:property value="businessTravelList.userInfoByVerifierId.userName"/></label>
		
	</p>
	<s:if test="businessTravels!=null&&businessTravels.size()!=0">
	<table  id="myTable">
		<tr>
			<th>开始地点</th>
			<th>目的地</th>
			<th>距离/公里</th>
			<th>交通方式</th>
			<th>住宿</th>
			<th>餐饮费/天</th>
			<th>其他费用/天</th>
			<th>天数</th>
			<th>本次费用/元</th>
		</tr>
		<s:iterator value="businessTravels" id="row" status="state">
			<tr>
				 <td align="center">
					<s:property value="#row.startPlace"/>
				</td>
				 <td align="center">
				 	<s:property value="#row.endPlace"/>
				</td>
				<td align="center">
					<s:property value="#row.distance"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.traffic.traffic"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.hotel.hotel"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.mealsCost"/>
				</td>
				<td align="center">
					<s:property value="#row.travelStandard.elseCost"/>
				</td>
				<td align="center">
					<s:property value="#row.time"/>
				</td>
				<td align="center">
					<s:property value="#row.sum"/>
				</td>
			</tr>
		</s:iterator>
	</table>
	</s:if>
	<s:else>
	<h2>没有具体的出差信息</h2>
	</s:else>
	<div align="center">
	<a href="personTravelInfoAction!getPersonTravelList.action">返回个人出差记录管理</a>
		<s:if test='businessTravelList.verifierStatus.equals("审核不通过")
		||businessTravelList.verifierStatus.equals("待审核")'>
			<a href="<s:url action="route!routeSetPrepareSetting.action?travelOrder=%{businessTravelList.travelOrder}" />" ><input type="submit" value="修改出差申请" class="button white"></a>
		</s:if>
		<s:elseif test='businessTravelList.verifierStatus.equals("审核通过")'>
			<a href="<s:url action='applayReimAction!getTravelInfoList.action?travelorder=%{businessTravelList.travelOrder}' />">
							<input type="submit" value="填写报销申请" class="button white"></a>
		</s:elseif>
	</div>
 </div>
    </s:elseif>
    <s:else>
    	没有符合条件的内容。
    </s:else>
 </div>
 </div>
 </section>
<script type="text/javascript">

		var tip= document.getElementById("travelstandrad").value;			
		
		
			$("#msg").hover(function(){
				layer.tips(tip,"#msg",{
					tips:[1,"#3595cc"]
				});
			
			});

		   var oTab = document.getElementById("tabs");
           var oUl = oTab.getElementsByTagName("ul")[0];
           var oLis = oUl.getElementsByTagName("li");
           var oDivs= oTab.getElementsByTagName("div");

           for(var i= 0,len = oLis.length;i<len;i++){  
               oLis[i].index = i;
               oLis[i].onclick = function() {
                   for(var n= 0;n<len;n++){
                       oLis[n].className = "";
                       oDivs[n].className = "hide";//隐藏的类名
                   }
	               this.className = "on";//显示的类名
	               oDivs[this.index].className = "";
	               var index = this.index;
               };
           }	
	//下载文件
	function downloadFile1(filenames, filepaths) {
		location.href = encodeURI("downloadAction.action?filenames=" + filenames
				+ "&filepaths=" + filepaths, "utf-8");
	}
	function SelectAll(oForm) {
		for ( var i = 0; i < oForm.url.length; i++) {
			oForm.url[i].checked = true;
		}
	}
	function TurnOver(oForm) {
		for ( var i = 0; i < oForm.url.length; i++) {
			oForm.url[i].checked = !oForm.url[i].checked;
		}
	}
	function DownlodSelected(oForm) {
		if (confirm("因需要在服务端动态打包,需要时间比较长,是否继续批量下载?")) {
			var arrDownloadList = [];
			for ( var i = 0; i < oForm.url.length; i++) {
				if (oForm.url[i].checked == true) {
					if (arrDownloadList.length == 0) {
						arrDownloadList[0] = oForm.url.value;
					}
					arrDownloadList[arrDownloadList.length] = oForm.url[i].value;
				}
			}
			if (arrDownloadList.length > 0) {
				var temp = [];
				var filenames = "";
				var filepaths = "";
				for ( var i = 1; i < arrDownloadList.length; i++) {
					temp = arrDownloadList[i].split(",")
					if (filenames == "" && filepaths == "") {
						filenames = temp[0]
						filepaths = temp[1]
					} else {
						filenames = filenames + "|" + temp[0];
						filepaths = filepaths + "|" + temp[1];
					}
				}
				downloadFile1(filenames, filepaths);
			} else {
				alert("还没有选中下载项");
			}
		}
	}
</script>
<%@ include file="../../footer.jsp" %>